SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

ALTER    function f_formatfloat(
  @value float,
  @demcial smallint
) 
returns  varchar(20) 
as
begin
  if ((@demcial < 0) or (@demcial > 8))
    set @demcial = 0
  set @value=round(@value, @demcial)
  declare @tmpv varchar(20)
  set @tmpv=cast(@value as varchar(20))
  while right(@tmpv,1)='0' and @tmpv<>'0'
  begin
    set @tmpv=substring(@tmpv,1,len(@tmpv)-1)
  end
  return @tmpv
end





GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

